package com.mrjy.video.controller;

import com.mrjy.common.entity.UserVideoRel;
import com.mrjy.custom.dto.CustomModuleCoursePackageDto;
import com.mrjy.video.bo.IUserVideoRelBo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
/**
 * 用户-视频关联表（用于统计用户看了视频）
 * @author csshui
 *
 */
@Controller
@RequestMapping("/video/userVideoRel")
public class UserVideoRelController {
	@Resource
	private IUserVideoRelBo userVideoRelBo;
	
	@RequestMapping("/insert")
	@ResponseBody
	public Object insert(UserVideoRel rel) {
		return userVideoRelBo.txInsert(rel);
	}	
		
	@RequestMapping("/updateById")
	@ResponseBody
	public Object updateById(UserVideoRel rel) {
		return userVideoRelBo.txUpdateById(rel);
	}	
	
	@RequestMapping("/queryByUserIdAndVideoId")
	@ResponseBody
	public Object queryByUserIdAndVideoId(UserVideoRel rel) {
		return userVideoRelBo.queryByUserIdAndVideoId(rel);
	}
	
	
	/**
	 * 微信1.5
	 * 根据videoId和userId查询用户观看某视频的进度
	 * @param rel
	 * @return
	 */
	@RequestMapping("/queryViewProgress")
	@ResponseBody
	public Object queryViewProgress(UserVideoRel rel){
		return userVideoRelBo.queryViewProgress(rel);
	}
	
	/**
	 * 微信1.5
	 * 修改视频观看进度
	 * @param rel
	 * @return
	 */
	@RequestMapping("/updateByUserIdAndVideoId")
	@ResponseBody
	public Object updateByUserIdAndVideoId(UserVideoRel rel) {
		return userVideoRelBo.updateByUserIdAndVideoId(rel);
	}
	
	
	/**
	 * 微信1.6 
	 * 观看历史
	 * @param rel.userId rel.rows rel.page
	 * @return
	 */
	@RequestMapping("/queryVideoViewHistoryByUserId")
	@ResponseBody
	public Object queryVideoViewHistoryByUserId(UserVideoRel rel) {
		return userVideoRelBo.queryVideoViewHistoryByUserId(rel);
	}
	
	/**
	 * 微信1.6 
	 * 同学排行榜--查询个人排名
	 * @param rel.userId
	 * @return
	 */
	@RequestMapping("/queryStudentsRankingByUserId")
	@ResponseBody
	public Object queryStudentsRankingByUserId(UserVideoRel rel) {
		return userVideoRelBo.queryStudentsRankingByUserId(rel);
	}
	
	/**
	 * 微信1.6 
	 * 同学排行榜--总排行榜
	 * @param rel.rows rel.page
	 * @return
	 */
	@RequestMapping("/queryStudentsRanking")
	@ResponseBody
	public Object queryStudentsRanking(UserVideoRel rel) {
		return userVideoRelBo.queryStudentsRanking(rel);
	}
	
	/**
	 * 微信1.6 
	 * 已学课程--已看课程包
	 * @param rel.userId
	 * @return
	 */
	@RequestMapping("/queryFinishedCoursePackListByUserId")
	@ResponseBody
	public Object queryFinishedCoursePackListByUserId(UserVideoRel rel) {
		return userVideoRelBo.queryFinishedCoursePackListByUserId(rel);
	}
	
	/**
	 * 微信1.6 
	 * 已学课程--已看视频
	 * @param rel.userId rel.rows rel.page
	 * @return
	 */
	@RequestMapping("/queryFinishedVideoListByUserId")
	@ResponseBody
	public Object queryFinishedVideoListByUserId(UserVideoRel rel) {
		return userVideoRelBo.queryFinishedVideoListByUserId(rel);
	}
	
	/**
	 * 微信1.6 
	 * 坚持天数排行榜-个人排行榜
	 * @param rel.userId 
	 * @return
	 */
	@RequestMapping("/queryKeepDayRankingListByUserId")
	@ResponseBody
	public Object queryKeepDayRankingListByUserId(UserVideoRel rel) {
		return userVideoRelBo.queryKeepDayRankingListByUserId(rel);
	}
	
	/**
	 * 微信1.6 
	 * 坚持天数排行榜
	 * @param rel.rows rel.page
	 * @return
	 */
	@RequestMapping("/queryKeepDayRankingList")
	@ResponseBody
	public Object queryKeepDayRankingList(UserVideoRel rel) {
		return userVideoRelBo.queryKeepDayRankingList(rel);
	}

    /**
     * 微信1.6
     * 坚持天数排行榜
     *
     * @param rel.rows rel.page
     * @return
     */
    @RequestMapping("/queryUserInCourseVideo")
    @ResponseBody
    public Object queryUserInCourseVideo(CustomModuleCoursePackageDto customModuleCoursePackageDto) {
        return userVideoRelBo.queryUserInCourseVideo(customModuleCoursePackageDto);
    }





}
